public class MyResource implements AutoCloseable {
    
    @Override
    public void close() throws Exception {
        // 进行资源释放操作,例如断开网络连接等.
        System.out.println("MyResource closed.");
    }
}